summaryrefslogtreecommitdiff
path: root/examples/blog-multiple-authors/src/pages/posts/[...page].astro
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blog-multiple-authors/src/pages/posts/[...page].astro')
-rw-r--r--examples/blog-multiple-authors/src/pages/posts/[...page].astro83
1 files changed, 0 insertions, 83 deletions
diff --git a/examples/blog-multiple-authors/src/pages/posts/[...page].astro b/examples/blog-multiple-authors/src/pages/posts/[...page].astro
deleted file mode 100644
index 3c6488855..000000000
--- a/examples/blog-multiple-authors/src/pages/posts/[...page].astro
+++ /dev/null
@@ -1,83 +0,0 @@
----
-import MainHead from "../../components/MainHead.astro";
-import Nav from "../../components/Nav.astro";
-import PostPreview from "../../components/PostPreview.astro";
-import Pagination from "../../components/Pagination.astro";
-import authorData from "../../data/authors.json";
-
-export async function getStaticPaths({ paginate, rss }) {
- const allPosts = await Astro.glob("../post/*.md");
- const sortedPosts = allPosts.sort(
- (a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf()
- );
-
- // Generate an RSS feed from this collection of posts.
- // NOTE: This is disabled by default, since it requires `site` to be set in your "astro.config.mjs" file.
- // rss({
- // title: 'Don’s Blog',
- // description: 'An example blog on Astro',
- // customData: `<language>en-us</language>`,
- // items: sortedPosts.map(item => ({
- // title: item.title,
- // description: item.description,
- // link: item.url,
- // pubDate: item.date,
- // })),
- // });
-
- // Return a paginated collection of paths for all posts
- return paginate(sortedPosts, { pageSize: 1 });
-}
-
-// page
-const title = "Don’s Blog";
-const description = "An example blog on Astro";
-const canonicalURL = new URL(Astro.url.pathname, Astro.site);
-const { page } = Astro.props;
----
-
-<html lang="en">
- <head>
- <title>{title}</title>
- <MainHead
- {title}
- {description}
- image={page.data[0].frontmatter.image}
- canonicalURL={canonicalURL.toString()}
- prev={page.url.prev}
- next={page.url.next}
- />
-
- <style lang="scss">
- .title {
- font-size: 3em;
- letter-spacing: -0.04em;
- margin-top: 2rem;
- margin-bottom: 0;
- text-align: center;
- }
-
- .count {
- font-size: 1em;
- display: block;
- text-align: center;
- }
- </style>
- </head>
-
- <body>
- <Nav {title} />
-
- <main class="wrapper">
- <h2 class="title">All Posts</h2>
- <small class="count">{page.start + 1}–{page.end + 1} of {page.total}</small>
- {page.data.map((post) => (
- <PostPreview post={post} author={authorData[post.frontmatter.author]} />
- ))}
- </main>
-
- <footer>
- <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
- </footer>
- </body>
-</html>